import tkinter as tk
from tkinter import ttk
 
root = tk.Tk()
root.geometry('320x240')
nb=ttk.Notebook(root)
tab1=tk.Frame(nb)
nb.add(tab1,text='Label',underline=3,sticky=tk.E)
tab2=tk.Frame(nb)
nb.add(tab2,text='Button')
nb.pack()

label1=tk.Label(tab1,text='标签1')
label1.pack()
button1=tk.Button(tab2,text='按钮1',width=20)
button1.pack()
def forget():
    nb.forget(0)
    
button2=tk.Button(root,text='Forget',command=forget)
button2.pack()
def add():
    nb.add(tab1,text='重新添加tab1')

button3=tk.Button(root,text='Add',command=add)
button3.pack()
root.mainloop()
